<h1>Listing pictures</h1>

<table>
  <tr>
  <% for column in Picture.content_columns %>
  <% #Removing body from the list, is too big for a simple list%>

        <th><%= column.human_name %></th>

  <% end %>
  </tr>
  
<% for picture in @pictures  %>
  <tr>
  <% for column in Picture.content_columns %>
    <% #Removing body from the list, is too big for a simple list%>
    <% if column.name == "data" %>
    <td>
    <img height="100px" width="100px" src="<%= url_for(:action => "picture", :id => picture.id) %>"/>
    </td>
    <% else %>
    <td><%=h picture.send(column.name) %></td>
    <% end %>
  <% end %>
    <td><%= link_to 'Show', :action => 'show_picture', :id => picture %></td>
    <td><%= link_to 'Edit', :action => 'edit_picture', :id => picture %></td>
    <td><%= link_to 'Destroy', { :action => 'destroy_picture', :id => picture }, :confirm => 'Are you sure?' %></td>
  </tr>
<% end %>
</table>

<%= link_to 'Previous page', { :page => @picture_pages.current.previous } if @picture_pages.current.previous %>
<%= link_to 'Next page', { :page => @picture_pages.current.next } if @picture_pages.current.next %>

<br />

<%= link_to 'New picture', :action => 'get_picture' %>
